home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1998 #4
/
Amiga Plus CD - 1998 - No. 4.iso
/
pd
/
musik
/
mrmpeg
/
insert.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-12-16
|
3KB
|
67 lines
/* Insert.rexx */
options results; address MrMPEG
MUIA_List_Active = 0x8042391c; MUIA_List_Entries = 0x80421654
MUIA_ShowMe = 0x80429ba8; MUIV_List_Active_Top = -2
list ID SLIST ATTRS MUIA_List_Entries; entries = result
popasl ID FPATH; fpath = result
temp_name = TmpFile('PIPE:MPEG_List.')
address command 'RequestFile >'temp_name 'DRAWER' fpath 'PATTERN "#?.(mp1|mp2|mp3)"
TITLE "Select MPEG files" MULTISELECT NOICONS'
if open('SongList', temp_name, 'r') = 1 then do
temp_list = readln('SongList')
call close('SongList')
if temp_list ~= "" then do
do forever
parse var temp_list '"' first '"' temp_list
if first == '' then leave
if exists(first) then do
popasl ID PATH; pathname = result
temp_name = TmpFile('PIPE:MPEG_Temp.')
address command pathname'MPEGA -h' first '>'temp_name
if open('Output', temp_name, 'r') = 1 then do /* Check if it can read song info or not */
null = readln('Output')
null = readln('Output')
null = readln('Output')
null = readln('Output')
info = readln('Output')
length = readln('Output')
call close('Output')
if left(info, 13) = ' File Type:' then do
parse var info dummy':' '
'detail'
'
parse var length dummy':' '
'temp_total_time'
'
list ID SLIST ATTRS MUIA_List_Active
if entries = 0 then result = result + 1
list ID SLIST INSERT NODUP POS result,
STRING first","temp_total_time","strip(detail)
end /* of if info */
else request ID WARN GADGETS '"OK"' '"Corrpted MPEG file."'
end /* of if open */
else request ID WARN GADGETS '"OK"' '"Could not open a pipe."'
end /* of if exists */
else do
temp_string = "Could not open the file '"first"'."
request ID WARN GADGETS '"OK"' temp_string
end
end /* of do forever */
list ID SLIST ATTRS MUIA_List_Entries; temp_max = result
setvar max temp_max
text ID MAX LABEL "\033b\033r"right(temp_max, 3)
temp_total_time = 0
do i = 0 to temp_max - 1
list ID SLIST POS i
parse var result dummy','temp_song_time','dummy2
temp_total_time = temp_total_time + left(temp_song_time, 2) * 60 + right(temp_song_time, 2)
end
temp_string = right(temp_total_time % 3600, 2, 0)||":"||,
right(temp_total_time // 3600 % 60, 2, 0)":"right(temp_total_time // 60, 2, 0)
setvar total_time temp_string
text ID TOTAL LABEL "\033b\033r"temp_string
if entries = 0 then list ID SLIST ATTRS MUIA_List_Active MUIV_List_Active_Top
end /* of if temp_list */
end /* of if open */
else request ID WARN GADGETS '"OK"' '"Could not open a pipe."'
return